package com.example.l_crm.facade;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.l_crm.model.ParmJsonModel;
import com.example.l_crm.model.PrjInf;
import com.example.l_crm.model.ReturnVO;
import com.example.l_crm.model.ScenFldVal;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 *
 */
@Component("AL21INSERTSINGLEPRJ")
@Slf4j
public class InsertSinglePrj implements BaseFacade {
    public ReturnVO doBusiness(ParmJsonModel parmJsonModel) {
        List<PrjInf> articleList = JSONObject.parseArray(JSON.toJSONString(parmJsonModel.getInfbdy().get("content1")), PrjInf.class);
        for (PrjInf prjInf : articleList) {
            System.out.println(prjInf.getScenFldValList());
            for (ScenFldVal scenFldVal : prjInf.getScenFldValList()) {
                System.out.println(scenFldVal);
            }
        }
        //TODO 保存项目信息

        System.out.println("AL21INSERTSINGLEPRJ 11111111111111 ...");
        ReturnVO returnVO = new ReturnVO();
        PrjInf prjInf = new PrjInf("ldj", "22222", null);
        returnVO.setMessage(prjInf);
        return returnVO;
    }
}
